package hust.music.util;

import java.io.File;

import org.farng.mp3.MP3File;
import org.farng.mp3.id3.AbstractID3v2;
import org.farng.mp3.id3.ID3v1;

public class Mp3Deal {

	private String album;
	private String singer;
	private String image;

	public void getSongInfo(File file) throws Exception {
		MP3File mp3File = new MP3File(file);
		AbstractID3v2 id3v2 = mp3File.getID3v2Tag();
		ID3v1 id3v1 = mp3File.getID3v1Tag();
		if (id3v2 != null) {
			album = id3v2.getAlbumTitle();
			singer = id3v2.getLeadArtist();
		} else {
			album = id3v1.getAlbumTitle();
			singer = id3v1.getLeadArtist();
		}

		ParsingHtml p = new ParsingHtml(album);
		image = p.getImageAddress();
	}


	public String getAlbum() {
		return album;
	}

	public void setAlbum(String album) {
		this.album = album;
	}

	public String getSinger() {
		return singer;
	}

	public void setSinger(String singer) {
		this.singer = singer;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

}
